home *** CD-ROM | disk | FTP | other *** search
Text File | 1988-01-27 | 2.3 KB | 70 lines | [TEXT/EDIT] |
- SUBROUTINE FaceIt(w1,m1,m2,m3,m4,m5)
- implicit none
- INTEGER FRONTWINDOW,GETRESOURCE,HIDEWINDOW,OPENRESFILE,PTR
- INTEGER TEINIT,INITDIALOGS,BLOCKMOVE
- PARAMETER (BLOCKMOVE=Z'02E98008')
- PARAMETER (FRONTWINDOW = Z'92480000')
- PARAMETER (GETRESOURCE = Z'9A091000')
- PARAMETER (HIDEWINDOW = Z'91610000')
- PARAMETER (OPENRESFILE = Z'99770000')
- PARAMETER (PTR = Z'C0000000')
- PARAMETER (TEINIT = Z'9CC00000')
- PARAMETER (INITDIALOGS = Z'97B10000')
- character*4 ftype1
- character*256 MAC,name,STR255,CHR256
- integer*4 w1,m1,m2,m3,m4,m5,FACEhdl,toolbx,saveAppl(3)
- integer*4 storage(512)
- common/macstuff/storage
- equivalence (storage(253),ftype1)
- equivalence (storage(261),FACEhdl)
- equivalence (storage(385),MAC)
- equivalence (storage(449),name)
- if (m2 = -1) then !first call to FaceIt?
- call toolbx(TEINIT) !perform Mac initializations
- call toolbx(INITDIALOGS,0)
- call toolbx(HIDEWINDOW,(toolbx(FRONTWINDOW))) !hide MF window
- ftype1 = 'FACE'
- if (toolbx(GETRESOURCE,ftype1,1000) = 0) then !find FaceIt glue
- name = STR255(name)
- if (toolbx(OPENRESFILE,name) < 0) stop !or quit
- end if
- FACEhdl = toolbx(GETRESOURCE,ftype1,1000) !store glue handle
- end if
- storage(49) = w1 !update window I/O #
- storage(50) = m1 !update macro commands
- storage(51) = m2
- storage(52) = m3
- storage(53) = m4
- storage(54) = m5
- if (m1 = 3).or.(m1 = 4) then !preserve trailing spaces for
- MAC(256:256) = 'x' !use in dialogs & alerts only
- name(256:256) = 'x'
- end if
- MAC = STR255(MAC) !Fortran-to-Pascal string conversion
- name = STR255(name)
- !save & later restore ApplScratch global memory
- call toolbx(BLOCKMOVE,Z'A78',toolbx(PTR,saveAppl),12)
- long(Z'A80') = toolbx(PTR,storage) !save storage address
- call JumpMF !jump to FaceIt glue
- call toolbx(BLOCKMOVE,toolbx(PTR,saveAppl),Z'A78',12)
- MAC = CHR256(MAC) !Pascal-to-Fortran string conversion
- name = CHR256(name)
- end
-
- character*256 FUNCTION STR255(string)
- character*(*) string
- i = len(trim(string))
- if (i = 256) i = 255
- STR255 = char(i)//string
- end
-
- character*256 FUNCTION CHR256(string)
- character*(*) string
- i = ichar(string(1:1))
- if (i > 0) then
- CHR256 = string(2:i+1)
- else
- CHR256 = ' '
- end if
- end
-